<?php
header('Content-type:text/html;charset=utf-8');
date_default_timezone_set('PRC');
// 载入读取信息
$date = include './mdb.php';
// 获取当前条数
$id= $_GET['id'];
$olddate = $date[$id];
// var_dump($olddate);
// 编辑提交信息
if(!empty($_POST)){
	$date= include './mdb.php';
	$date[$id]=$_POST;
	$phpCode =var_export($date,true);
	file_put_contents('./mdb.php',"<?php \r\n return " .$phpCode ."\r\n?>");
$js=<<<js
<div id="sue" style='display:block;'><div class="alert">提示信息<br />编辑成功！2秒后跳转首页若无响应请<a href='liuyanben.php' >点此返回</a></div></div>
js;
echo $js;
 echo "<script>setTimeout(function(){window.location.href='liuyanben.php'},2000)</script>";

}
$date= include './mdb.php';
// var_dump($date);

 // 存储写入信息
 
// 跳转首页




 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>发布留言信息</title>
	<link rel="stylesheet" type="text/css" href="css/edit.css" />
	<script type="text/javascript" src='js/jquery-1.7.2.min.js'></script>
		<script type="text/javascript">
		$(function(){
	$('.bgchose ul li').click(function() {
		var i=$(this).index();
		$('#main').css('background','url(images/userico/bg'+i+'.jpg) no-repeat');
		$(':radio[name="bgchose"]').eq(i).attr("checked",true);
		$('#style').val('style'+i+'css');
	});	
	$('.userpicchose ul li').click(function() {
		var i=$(this).index();
		$(':radio[name="userpicchose"]').eq(i).attr("checked",true);
	});

		})
		</script>
</head>
<body>

	<div id="main">
	<form action="" method="post">
	         <!--  left  content -->
	          <div id="left">
	            <!-- 用户图像 选择 -->
	            <ul>
	            	
	         	 <li class="tit">选择图像</li>
	            <div class="userpicchose">	            
	            <ul>
	 				<li class="radio">
	 				<img src="images/userico/1.jpg" height="220" width="200" alt="">
	 				<p><input type="radio" name="userpicchose" checked="checked" value="1.jpg" />图像1</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/2.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="2.jpg" />图像2</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/3.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="3.jpg" />图像3</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/4.jpg" alt="">
	 				<p><input type="radio" name="userpicchose" value="4.jpg" />图像4</p>
	 				</li>
	 				<li class="radio">
	 				<img src="images/userico/5.jpg" alt="">
	 				<p><input type="radio" name="userpicchose"  value="5.jpg"  />图像5</p>
	 				</li>




	             </ul>
	            </div>
	            <!-- 背景选择 -->
	             <li class="tit">选择背景</li>
	            <div class="bgchose">

	            	<ul>
	            		<li class="radio">
	            		<img src="images/userico/bgico1.jpg" alt="">
	            		<p><input type="radio" name="bgchose"  checked="checked"  value="bg0.jpg" />背景图片1</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico2.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg1.jpg" />背景图片2</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico3.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg2.jpg" />背景图片3</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico4.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg3.jpg" />背景图片4</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico5.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg4.jpg" />背景图片4</p>
	            		</li>
	            		<li class="radio">
	            		<img src="images/userico/bgico6.jpg" alt="">
	            		<p><input type="radio" name="bgchose" value="bg5.jpg" />背景图片4</p>
	            		</li>


	            		
	            	 </ul>
	            </div>
	            <!-- 用户信息 -->
	            <div class="userinfo">
	              <ul>
	                <li class="tit">昵称：</li><li><input type="text" name="user" value="<?php echo $olddate['user']?>" /></li>
	                 <li  class="tit">QQ：</li><li><input type="text" name="qq" value="<?php echo $olddate['qq']?>" /></li>
	                  <li  class="tit">邮箱：</li><li><input type="text" name="email" value="<?php echo $olddate['email']?>" /></li>
	                  <li  class="tit">地址：</li><li><input type="text" name="addess" value="<?php echo $olddate['addess']?>" /></li>
	                 
	              </ul>
	            </div>
	               </ul>
	          </div>
	         <!-- left content end -->
	      
	        <div class="preview-content right toc">
	        <!-- right content -->
	          
	        <div id="right">
	          <!-- 留言信息 -->
	          <div class="message">
	            <ul>
	                <li  class="tit">留言信息：</li>
	              <li class="msgcon">
	              <textarea name="msgcon" id="" cols="30" rows="10" ><?php echo $olddate['msgcon']?></textarea>
	              </li>
	                <li  class="tit">个性签名：</li>
	              <li class="sign">
	                 <textarea name="sign" id="" cols="30" rows="10"><?php echo $olddate['sign']?></textarea>
	              </li>
	            </ul>
	          </div>
	      <input type="hidden" name="time" value="<?php echo date('y/m/d H:i:s'); ?>" />
				<input type="hidden" name="style" id="style" value="style1.css" />
	          <input type="submit"  id="btn" value="提交" />
	        </div>
	        <!-- right content  end-->    
	        </div> 
	        	</form>  
</div>
</body>
</html>